home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_075 / speeddir / poster next >
Text File  |  1992-05-06  |  5KB  |  139 lines

  1. Article 4532 of comp.sys.amiga:
  2. Path: mcdsun!noao!hao!ames!ucbcad!ucbvax!COGSCI.BERKELEY.EDU!bryce
  3. From: bryce@COGSCI.BERKELEY.EDU (Bryce Nesbitt)
  4. Newsgroups: comp.sys.amiga
  5. Subject: Faster directories under AmigaDOS -> binary incl.
  6. Message-ID: <8705110932.AA29181@cogsci.berkeley.edu>
  7. Date: 11 May 87 09:32:57 GMT
  8. Sender: usenet@ucbvax.BERKELEY.EDU
  9. Lines: 157
  10.  
  11.  
  12. This article describes a easy way to get faster directories under AmigaDOS.
  13. The method described is:
  14.  
  15. 1> 100% compatible.
  16. 2> Takes zero bytes of ram.
  17. 3> Works with existing disks -> no format changes.
  18. 4> Takes zero time to load.
  19.  
  20. All it requires is a tiny li
  21.  
  22.   woah!!! EaThQuAke!!!     (Good thing I don't live on landfill)
  23.   (Darn California earthquakes are always interrupting things)
  24.   (I would guess about 4.7 and from the south)
  25.  
  26.                 ttle change to the source code to AmigaDOS;
  27. which sadly I do not have access to.  :-(
  28.  
  29.  
  30. The dos function that gets the next directory entry is Brain_Dead (like
  31. most of the filesystem).  It does many, many things as to guarantee that
  32. it is slow!  Two examples:
  33.  
  34. 1> It reads entries in HASH order; as far as the disk is concered this
  35. means RANDOM order.  The dos could read one entry from Track 20 then
  36. another from 21 and then end up back at 20 for the next.
  37.  
  38. 2> It reads *all* the extension blocks of a file for the purpose of
  39. counting the total blocks; since the filesystem will currently fill every
  40. block full except the last, a DIVIDE will do the same at much less cost.
  41.  
  42.  
  43. Here is a example snoop of a directory taken under the standard AmigaDOG
  44. filesystem:
  45.  
  46.    Block 880    -> Track 40  Head 0
  47.    Block 881    -> Track 40  Head 0
  48.    Block 882    -> Track 40  Head 0
  49.    Block 889    -> Track 40  Head 0
  50.    Block 891    -> Track 40  Head 1
  51.    Block 1011    -> Track 45  Head 1
  52.    Block 1013    -> Track 46  Head 0
  53.    Block 1039    -> Track 47  Head 0
  54.    Block 1041    -> Track 47  Head 0
  55.    Block 1082    -> Track 49  Head 0
  56.    Block 1089    -> Track 49  Head 1
  57.    Block 1180    -> Track 53  Head 1
  58.    Block 1183    -> Track 53  Head 1
  59.    Block 1184    -> Track 53  Head 1
  60.    Block 1186    -> Track 53  Head 1
  61.    Block 1199    -> Track 54  Head 1
  62.    Block 1186    -> Track 53  Head 1
  63.    Block 1200    -> Track 54  Head 1
  64.    Block 1202    -> Track 54  Head 1
  65.    Block 1273    -> Track 57  Head 1
  66.    Block 1296    -> Track 58  Head 1
  67.    Block 1299    -> Track 59  Head 0
  68.    Block 1301    -> Track 59  Head 0
  69.    Block 1303    -> Track 59  Head 0
  70.    Block 1305    -> Track 59  Head 0
  71.    Block 883    -> Track 40  Head 0
  72.    Block 1307    -> Track 59  Head 0
  73.    Block 1187    -> Track 53  Head 1
  74.  
  75. Notice how it goes from Track 53 to 54 to 53 to 54?  That's 3 steps; a
  76. *LONG* time.  Now take a look at what the program presented here does;
  77.  
  78.    Block 880    -> Track 40  Head 0
  79.    Block 881    -> Track 40  Head 0
  80.    Block 882    -> Track 40  Head 0
  81.    Block 883    -> Track 40  Head 0
  82.    Block 889    -> Track 40  Head 0
  83.    Block 891    -> Track 40  Head 1
  84.    Block 1011    -> Track 45  Head 1
  85.    Block 1013    -> Track 46  Head 0
  86.    Block 1039    -> Track 47  Head 0
  87.    Block 1041    -> Track 47  Head 0
  88.    Block 1082    -> Track 49  Head 0
  89.    Block 1089    -> Track 49  Head 1
  90.    Block 1180    -> Track 53  Head 1
  91.    Block 1183    -> Track 53  Head 1
  92.    Block 1184    -> Track 53  Head 1
  93.    Block 1186    -> Track 53  Head 1
  94.    Block 1187    -> Track 53  Head 1
  95.    Block 1200    -> Track 54  Head 1
  96.    Block 1202    -> Track 54  Head 1
  97.    Block 1273    -> Track 57  Head 1
  98.    Block 1296    -> Track 58  Head 1
  99.    Block 1299    -> Track 59  Head 0
  100.    Block 1301    -> Track 59  Head 0
  101.    Block 1303    -> Track 59  Head 0
  102.    Block 1305    -> Track 59  Head 0
  103.    Block 1307    -> Track 59  Head 0
  104.  
  105. It *SORTS* the blocks to reduce the number of needed seeks.  It also
  106. DIVIDES the number of bytes to get the number of blocks in the file.
  107. (ie: It assumes each block is full -> a fair assumption considering the
  108. current filesystem and the relative unimportance of the information)
  109.  
  110. It's not perfect; hash chains can force it to deviate, but it's better, and
  111. if properly implemented, totaly transparant.
  112. This program is not such a beast; it is a quick rehash of a program done
  113. back when I tried to convince Commodore to place such a change in V1.2.
  114. [Nothing happened].  It is not fully finished, I decided the old filesystem
  115. is incurable; and must be 'burried deep'.  Fortunatly it is very clean to
  116. invent a *NEW* filesystem.
  117.  
  118. To start it "RUN SPEEDDIR" from a CLI.  It will replace directory handlers
  119. for drive DF1:.  (Use a disk editor and change the string if you only
  120. have a DF0:)
  121.  
  122. It works by patching the pr_PktWait field and handling packets of type
  123. ExNext.  For each packet it gets, it sets up a brand new message port,
  124. ,calls Trackdisk, then deallocates things.  It will leave the drive
  125. on after a read.
  126. -> NOTE <- I do not know how to link into the buffers that AmigaDOS keeps;
  127. this program is faster *WITHOUT* the use of cached blocks.  If anyone
  128. can help me on this point; PLEASE DO!
  129.  
  130. DISCLAIMER:  This code is UNFINISHED, probably BUGGY, is UNCLEAN and is
  131. intended for use by HACKERS ONLY.  Commodore-Amiga/Metacomo you are welcome
  132. to use these ideas for the next release -> but, better yet, write a *real*
  133. filesystem.
  134.  
  135. -Bryce Nesbitt-   // Dedicated to eradicating all traces of
  136.            \\//  this latest world-wide outbreak of BCPL.
  137.  
  138. bryce@cogsci.berkeley.edu
  139.